package cn.funeralobjects.youtube.dl.extension.controller.handler;

import cn.funeralobjects.youtube.dl.extension.exception.YoutubeDlException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author FuneralObjects
 * Create date: 2020/4/8 2:27 PM
 */
@RestControllerAdvice
public class RestExceptionHandler {

    @ExceptionHandler(YoutubeDlException.class)
    public ResponseEntity<String> youtubeDlExceptionHandler(YoutubeDlException e){
        return ResponseEntity.badRequest().body("Youtube-dl process failed:"+e.getMessage());
    }
}
